package d1113;

public abstract class Animal {
    protected String name;

    public Animal(){
    }

    public Animal(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    protected abstract void shout();

    protected void eat(Food food){
        System.out.println(this.name+"在吃"+food.getName());
    }

}



class Cat extends Animal {

    public Cat() {
    }

    public Cat(String name) {
        super(name);
    }

    @Override
    public void shout() {

        System.out.println("哇哦哇哦叫");
    }
}
class Dog extends Animal {


    public Dog() {
    }

    public Dog(String name) {
        super(name);
    }

    @Override
    public void shout() {
        System.out.println("嗷呜嗷呜叫");
    }
}


